#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> v;
        v.resize(numRows);
        for (int i = 0; i < numRows; i++)
        {
            v[i].resize(i + 1, 0);
            (v[i])[0] = (v[i])[i] = 1;
        }
        for (int i = 2; i < numRows; i++)
        {
            for (int j = 1; j < v[i].size() - 1; j++)
            {
                v[i][j] = v[i - 1][j - 1] + v[i - 1][j];
            }
        }

        return v;
    }
};